package shape2D;     // 改包名时可能导致乱码

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.shape.*;
import javafx.scene.paint.Color;

// 弧(椭圆的一段) 
public class ArcDemo extends Application { 
	private Pane root = new Pane();
	private Arc a1;
	private Arc a2;
	private Arc a3;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		root.setStyle("-fx-background-color: linear-gradient(to right, #FAEBD7, #87CEFA)");  // 设置颜色渐变(方向加颜色的RGB值)
		
		// 扇形(通过设置弧的类型)
		a1 = new Arc();
		a1 = new Arc(150, 100, 80, 80, 0, 30);      // 前四项同椭圆，后面为起始角度和终止角度
		a1.setFill(Color.ORANGE);
		a1.setStroke(Color.BLACK);
		a1.setType(ArcType.ROUND);           
		root.getChildren().add(a1);
			
		// 不闭合的弧
		a2 = new Arc();
		a2 = new Arc(150, 100, 80, 80, 90, 90);
		a2.setFill(Color.WHITE);
		a2.setStroke(Color.BLACK);
		a2.setType(ArcType.OPEN);
		root.getChildren().add(a2);
				
		// 闭合的弧
		a3 = new Arc();
		a3 = new Arc(150, 100, 80, 80, 200, 90);
		a3.setFill(Color.BLUE); 
		a3.setStroke(Color.BLACK);
		a3.setType(ArcType.CHORD);
		root.getChildren().add(a3);
		
		Scene scene = new Scene(root, 300, 200);
		stage.setScene(scene);
		stage.show();
	}
}





